var express = require('express');
var router = express.Router();
const getuserController = require("../controllers/getuser_controller")
router.get("/getuser", (req, res) => {
    var {
        page,
        pagesize,
        account
        // collectionName
    } = req.query
    // console.log(page,pagesize);
    // console.log(collectionName);
    getuserController.getuserlist(account, ["查询失败", "查询成功"], (result) => {
        res.json(result)
    })
})
router.post("/adduser", (req, res) => {
    var {
        userObj
        // collectionName
    } = req.body
    console.log(userObj);
    // console.log(collectionName);
    getuserController.adduserlist(userObj, ["添加失败", "添加成功"], (result) => {
        res.json(result)
    })
})
router.patch("/patchuser", (req, res) => {
    var {
        userObj
        // collectionName
    } = req.body
    // console.log(userObj);
    // console.log(collectionName);
    getuserController.patchuserlist(userObj, ["修改失败", "修改成功"], (result) => {
        res.json(result)
    })
})
router.delete("/deleteuser", (req, res) => {
    var {
        useraccount
        // collectionName
    } = req.body
    console.log(useraccount);
    // console.log(collectionName);
    getuserController.deleteuserlist(useraccount, ["删除失败", "删除成功"], (result) => {
        res.json(result)
    })
})
module.exports = router;
